# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=libblastrampoline
pkgver=5.2.0
pkgrel=0
pkgdesc="Using PLT trampolines to provide a BLAS and LAPACK demuxing library"
url="https://github.com/JuliaLinearAlgebra/libblastrampoline"
# x86: TEXTREL
# others: not supported by upstream
arch="aarch64 armv7 x86_64"
license="MIT"
makedepends="linux-headers"
subpackages="$pkgname-dev"
source="https://github.com/JuliaLinearAlgebra/libblastrampoline/archive/v$pkgver/libblastrampoline-$pkgver.tar.gz"
options="!check"  # tests require nightly julia

_arch=$CARCH
case "$CARCH" in
	armv7) _arch='arm';;
esac

build() {
	make -C src ARCH="$_arch" CFLAGS="${CFLAGS/-Os/}"
}

package() {
	make -C src install ARCH="$_arch" prefix="$pkgdir/usr"

	cd "$pkgdir"
	find usr/include/libblastrampoline/*LP64 \
		-type d -mindepth 1 ! -name "$_arch*-linux-musl*" ! -name common \
		-exec rm -vrf {} +
}

sha512sums="
543d6d858daea9daadcb6f795e833f59cb27590015f5d4c84f24594ddc8fb51cdd473c93fa2acc9bf331b39aa252a6901a23b2e40655797a0b3106276095c429  libblastrampoline-5.2.0.tar.gz
"
